/*
 * Copyright 2011 Kim Lindhardt Madsen
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package dk.lindhardt.gwt.geie.server.convert;

import dk.lindhardt.gwt.geie.shared.Cell;
import dk.lindhardt.gwt.geie.shared.CellFormatKey;
import dk.lindhardt.gwt.geie.shared.Position;
import jxl.CellType;
import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;

/**
 * User: AnAmuser
 * Date: 12-08-11
 * <p/>
 * Describing how a {@link Cell} is converted into a {@link jxl.write.WritableCell} and
 * a {@link jxl.Cell} into a {@link Cell}
 */
public interface CellConverterStrategy {

   /**
    * Get jxl cell types being handled by this converter strategy.
    * @return the cell type
    */
   public CellType[] getJXLTypes();

   /**
    * Get geie cell type being handled by this converter strategy.
    * @return the cell type
    */
   public Class<? extends Cell> getGeieType();

   /**
    * Converts a geie into a jxl writable. The writable cell is the one that is used in the excel sheet.
    * @param cell the cell to be converted
    * @param cellFormat the cell format used on this cell
    * @return a writable cell
    */
   public WritableCell convert(Cell cell, WritableCellFormat cellFormat);

   /**
    * Converts a jxl cell into geie cell. The  geie cell is the one that is used in the table layout.
    * @param cell the cell to be converted
    * @param position position on the cell
    * @param cellFormat the cell format used on this cell
    * @return a geie cell
    */
   public Cell convert(jxl.Cell cell, Position position, CellFormatKey cellFormat);
}
